@ECHO OFF

REM RESTful DDS is a prototyping effort to demonstrate how DDS could be combined
REM with HTTP clients, extending the realm of pub/sub distribution to true wide
REM area networking.
REM
REM Copyright (C) 2009 PrismTech Ltd.
REM reinier.torenbeek@gmail.com
REM
REM This library is free software; you can redistribute it and/or
REM modify it under the terms of the GNU Lesser General Public
REM License Version 3 dated 29 June 2007, as published by the
REM Free Software Foundation.
REM
REM This library is distributed in the hope that it will be useful,
REM but WITHOUT ANY WARRANTY; without even the implied warranty of
REM MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
REM Lesser General Public License for more details.
REM
REM You should have received a copy of the GNU Lesser General Public
REM License along with restful-dds; if not, write to the Free Software
REM Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA

IF "_%1"=="_" (
  SET TARGET=all
) ELSE (
  SET TARGET=%1
)

IF "%TARGET%"=="all" GOTO Clean
IF "%TARGET%"=="keeplibs" GOTO Clean

ECHO Unknown target %TARGET%
GOTO End

:Clean
SET DEL_DIR=RMDIR /S /Q

SET GEN_DIR=generated
SET OBJ_DIR=obj
SET LIB_DIR=lib

SET SERVICE_GEN_DIR=%GEN_DIR%
SET SERVICE_OBJ_DIR=%OBJ_DIR%
SET SERVICE_LIB_DIR=%LIB_DIR%

ECHO Cleaning up RESTful service
ECHO Cleaning compiled classes
IF EXIST %SERVICE_OBJ_DIR% %DEL_DIR% %SERVICE_OBJ_DIR%
ECHO Cleaning generated source code
IF EXIST %SERVICE_GEN_DIR% %DEL_DIR% %SERVICE_GEN_DIR%

SET TUTORIAL_DIR=Tutorial
ECHO Cleaning OpenSplice Tutorial 
IF EXIST %TUTORIAL_DIR% %DEL_DIR% %TUTORIAL_DIR%

SET BATTLESHIP_NAME=battleship
SET WWW_DIR=www
SET WEBAPP_DIR=displaywebapp

SET BATTLESHIP_DIR=demos\%BATTLESHIP_NAME%
SET BATTLESHIP_GEN_DIR=%BATTLESHIP_DIR%\%GEN_DIR%
SET BATTLESHIP_OBJ_DIR=%BATTLESHIP_DIR%\%OBJ_DIR%
SET BATTLESHIP_LIB_DIR=%BATTLESHIP_DIR%\%LIB_DIR%
SET BATTLESHIP_WWW_DIR=%BATTLESHIP_DIR%\%WWW_DIR%

ECHO Cleaning up Battleship demo
ECHO Cleaning compiled classes
IF EXIST %BATTLESHIP_OBJ_DIR% %DEL_DIR% %BATTLESHIP_OBJ_DIR%
ECHO Cleaning generated source code
IF EXIST %BATTLESHIP_GEN_DIR% %DEL_DIR% %BATTLESHIP_GEN_DIR%


IF "%TARGET%"=="keeplibs" GOTO End

ECHO Cleaning jars
IF EXIST %SERVICE_LIB_DIR% %DEL_DIR% %SERVICE_LIB_DIR%
IF EXIST %BATTLESHIP_LIB_DIR% %DEL_DIR% %BATTLESHIP_LIB_DIR%
ECHO Cleaning generated Web Application
IF EXIST %BATTLESHIP_WEBAPP_DIR% %DEL_DIR% %BATTLESHIP_WEBAPP_DIR%

:End